<template>
  <svg
    :class="svgClass"
    aria-hidden="true"
    :color="svgColor"
  >
    <use :xlink:href="iconName" />
  </svg>
</template>


<script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator';

@Component({ components: {} })
export default class SvgIcon extends Vue {
  @Prop({ default: null, type: String })
  iconClass!: String;

  @Prop({ default: '', type: String })
  className!: String;

  @Prop({ default: null, type: String })
  svgColor!: String;

  get iconName() {
    return `#icon-${this.iconClass}`;
  }

  get svgClass() {
    if (this.className) return `svg-icon ${this.className}`;
    return 'svg-icon';
  }
}
</script>

<style scoped>
.svg-icon {
  width: 2em;
  height: 2em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>
